home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / SYMBMATH.H17 < prev    next >
Text File  |  1994-03-29  |  3KB  |  67 lines

  1.         3.3.7  Read and Write Statements
  2.     The format of the readfile statement is
  3.         readfile("filename")
  4. The filename is any MS-DOS file name. If the file is not in the current
  5. directory, the filename should include the directory. e.g.
  6.                 readfile("directory\filename")
  7.         e.g. read a file named "inte.sm":
  8.         readfile("inte.sm")
  9.         It seems to copy the file into the user program.
  10.     After a file is read, you can call any part of this package from
  11. a second package, as it seems the part of the first program has already
  12. been in the second program. you can read many files into the SymbMath
  13. program at a time. However, all names of the variables are public and
  14. name conflicts must be avoided.
  15.     Write a file to disk by
  16.         openfile("file")
  17.         ...
  18.         closefile("file")
  19.         
  20.     Table 3.3.7.         Reading and Writing Statements
  21. ---------------------------------------------------------------------
  22. readchar                read a charactor from  keyboard.
  23. readline                read a line of strings from keyboard.                                                
  24. readfile("file")        read (run or include) the file named "file".
  25. ......................................................................
  26. openfile("file")        open the disk file "file" for writing.
  27. closedfile("file")      closed the file "file".
  28. writes(s)               write s on screen, only on graphics mode.
  29. newline                 write next text on a new line.
  30. null                    not write.
  31. block(a,b)              write the value of the last arguement, b.
  32. ---------------------------------------------------------------------
  33. where the filename is any MS-DOS filename.
  34.     Note that the file must be closed by the closefile() command when
  35. writing a file with the openfile() command, but the file is automatically
  36. closed after reading the file. There must be the end statement at the end
  37. of file for reading.
  38.     SymbMath can read expressions from a disk file, then manipulate 
  39. the expression, and finally write the result into another disk file.
  40.     Example: an expression y:=x^6 is already in the file "y.in",
  41.  
  42. The contents of the file "y.in":
  43. ---------------------------------------------------------------------
  44. y:=x^6
  45. -----------------------------------------------------------------------
  46.  
  47.     run this SymbMath program
  48. ----------------------------------------------------------------------------
  49. readfile("y.in")        # read the expression y:=x^6 from the file "y.in"
  50. openfile("y.out")       # open a disk file "y.out" for writing
  51. d(y,x)                  # differentiate y and write the result to the file
  52. closefile("y.out")      # close the file and return output to SymbMath
  53. ----------------------------------------------------------------------------
  54.  
  55. The contents of the file "y.out":
  56. ---------------------------------------------------------------------
  57. 6*x^5
  58. ---------------------------------------------------------------------
  59.  
  60. In this way you can interface to other software (see 3.7. Interface with
  61. Other Software).
  62.     These outputs in the disk file can be edited in the Edit window 
  63. or the Aux Edit window. 
  64.     It is recommended to use the BASIC output format by setting 
  65. the switch output:=basic when you write the output into the disk file.
  66. The default switch is output:=math.
  67.